/**
 * 字符串打点
 */
export const download = (res, fileName) => {
  const blob = new Blob([res], { type: "charset=utf-8;" });
  if ("download" in document.createElement("a")) {
    //支持a标签download的浏览器
    const link = document.createElement("a"); //创建a标签
    link.download = fileName; //a标签添加属性
    link.style.display = "none";
    link.href = URL.createObjectURL(blob);
    document.body.appendChild(link);
    link.click(); //执行下载
    URL.revokeObjectURL(link.href); //释放url
    document.body.removeChild(link); //释放标签
  } else {
    navigator.msSaveBlob(blob, fileName);
  }
};
